package com.shitou.shitoucommons.exception;

import com.shitou.shitoucommons.utils.RespBean;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.MethodArgumentNotValidException;

/**
 * interface detail:
 *
 * @author 石头人
 */
@SuppressWarnings("all")
public interface ControllerAdvice {

    /**
     * 绑定异常,controller方法中的参数校验失败
     * @param methodArgumentNotValidException
     * @return RespBean
     */
    RespBean bindingException(MethodArgumentNotValidException methodArgumentNotValidException);

    /**
     * 空指针异常
     * @param nullPointerException
     * @return RespBean
     */
    RespBean nullPointException(NullPointerException nullPointerException);


    /**
     * 所有的抛出的异常
     * @param throwable
     * @return RespBean
     */
    RespBean handleException(Throwable throwable);


    /**
     * http信息无可读
     * @param exception
     * @return RespBean
     */
    RespBean httpMessageNotReadAbleException(HttpMessageNotReadableException exception);


    /**
     * 运行时异常
     * @param exceptions
     * @return RespBean
     */
    RespBean runtimeException(RuntimeException exceptions);
}
